FROM alpine:3.14
LABEL MAINTAINER="linweile<674969619@qq.com>"

ARG DEBIAN_FRONTEND=noninteractive
# 取消命令行交互

USER root
# 切换用户
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories

RUN apk update

#切换中国时间
RUN apk add tzdata
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN  echo "Asia/Shanghai" > /etc/timezone
#------

# 需要编译安装的php
RUN apk add gcc
RUN apk add make
RUN apk add pkgconf
RUN apk add libxml2-dev
RUN apk add sqlite-dev
RUN apk add oniguruma-dev
RUN apk add curl-dev
RUN apk add openssl-dev
RUN apk add libzip-dev
RUN apk add zlib-dev
RUN apk add libpng-dev
RUN apk add build-base
#


# 安装php
ADD ./zip/php-8.2.8.tar.gz /

RUN cd /php-8.2.8 && ./configure --prefix=/usr/local --with-pear  --enable-gd --enable-mbstring --with-curl --with-pdo-mysql --with-openssl --with-zip

RUN cd /php-8.2.8 && make && make install
#

# 编译swoole 所需的环境
RUN apk add  autoconf
RUN apk add  openssl
ADD ./zip/swoole-src-5.0.3.tar.gz /
#  -----------


#  -----------  php.ini 所在位置 /etc/php/8.3/cli
RUN cd /swoole-src-5.0.3 && phpize && ./configure --enable-openssl --with-openssl-dir=/usr/include/openssl && make && make install
# 编译安装swoole


# ------------  /usr/bin/php-config8.2
RUN echo no | pecl install redis
# 编译安装php-redis拓展

# ------------
RUN  apk add libmemcached-dev
RUN  apk add zlib-dev
RUN  echo no | pecl install memcached
# 安装memcached拓展和所需的环境


RUN  pecl install mongodb

#  编译安装mongodb拓展

# # ------------
RUN  apk add git
#  安装git

# # ------------
RUN  apk add unzip
#  安装unzip 避免composer警告


#------------
RUN apk add nodejs npm
#  安装nodejs



COPY  ./volumes/php-cli/php.ini  /usr/local/lib





